{
  "properties" : { },
  "id" : "92c4ec4ef21c48a489dc65aaaed368d3",
  "script" : null,
  "groupId" : "e35868754ede47b48b4d0f880b121a5d",
  "name" : "下载文件次数",
  "createTime" : null,
  "updateTime" : 1662343317155,
  "lock" : null,
  "createBy" : null,
  "updateBy" : null,
  "path" : "/fileDownloadNumber",
  "method" : "POST",
  "parameters" : [ ],
  "options" : [ ],
  "requestBody" : "",
  "headers" : [ ],
  "paths" : [ ],
  "responseBody" : "{\n    \"code\": -1,\n    \"message\": \"系统内部出现错误\",\n    \"data\": null,\n    \"timestamp\": 1662298707127,\n    \"executeTime\": 9252\n}",
  "description" : null,
  "requestBodyDefinition" : null,
  "responseBodyDefinition" : {
    "name" : "",
    "value" : "",
    "description" : "",
    "required" : false,
    "dataType" : "Object",
    "type" : null,
    "defaultValue" : null,
    "validateType" : "",
    "error" : "",
    "expression" : "",
    "children" : [ {
      "name" : "code",
      "value" : "-1",
      "description" : "",
      "required" : false,
      "dataType" : "Integer",
      "type" : null,
      "defaultValue" : null,
      "validateType" : "",
      "error" : "",
      "expression" : "",
      "children" : [ ]
    }, {
      "name" : "message",
      "value" : "系统内部出现错误",
      "description" : "",
      "required" : false,
      "dataType" : "String",
      "type" : null,
      "defaultValue" : null,
      "validateType" : "",
      "error" : "",
      "expression" : "",
      "children" : [ ]
    }, {
      "name" : "data",
      "value" : "null",
      "description" : "",
      "required" : false,
      "dataType" : "Object",
      "type" : null,
      "defaultValue" : null,
      "validateType" : "",
      "error" : "",
      "expression" : "",
      "children" : [ ]
    }, {
      "name" : "timestamp",
      "value" : "1662298707127",
      "description" : "",
      "required" : false,
      "dataType" : "Long",
      "type" : null,
      "defaultValue" : null,
      "validateType" : "",
      "error" : "",
      "expression" : "",
      "children" : [ ]
    }, {
      "name" : "executeTime",
      "value" : "9252",
      "description" : "",
      "required" : false,
      "dataType" : "Integer",
      "type" : null,
      "defaultValue" : null,
      "validateType" : "",
      "error" : "",
      "expression" : "",
      "children" : [ ]
    } ]
  }
}
================================
import log;
import '@post:/mysql/table/fileDownloadNumber/query/byusernameByfilename' as queryList;
import '@post:/mysql/table/fileDownloadNumber/insert/all' as insertList;
import '@post:/mysql/table/fileDownloadNumber/update/byusernameByfilename' as updateList;
var list = queryList();
var num;
if (list.size() > 0) {
    num = list.get(0).download_number::int;
}
if (num == null) {
    num = 0;
}
if (num.equals(0)) {
    num += 1;
    insertList(num);
} else {
    num += 1;
    updateList(num);
}